<template>
    <table class="table-bordered" border="1px">
        <tr>
            <td>用户名称</td>
            <td>
                <input type="text" v-model="info.Member_Name" placeholder="请输入用户名称"/>
            </td>
        </tr>
        <tr>
            <td>用户密码</td>
            <td>
                <input type="password" v-model="info.Member_Pwd" placeholder="请输入用户密码"/>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <input type="button" value="登录" class="btn btn-success" @click="SaveData"/>
            </td>
        </tr>
    </table>
</template>
<script setup lang="ts">
import axios from 'axios';
import { onMounted,ref } from 'vue';

//创建响应式数据
const info=ref({
    Member_Name:"",
    Member_Pwd:""
})

const SaveData=()=>{
    if(info.value.Member_Name=="")
    {
        alert("请输入用户名称")
        return;
    }
    if(info.value.Member_Pwd=="")
    {
        alert("请输入密码")
        return;
    }
    axios.get("https://localhost:7035/api/Member/MemberLogin",
    {
        params:
        {
            Mname:info.value.Member_Name,
            Mpwd:info.value.Member_Pwd
        }
    })
    .then(res=>{
        if(res.data.Comm_Code==0)
        {
            alert(res.data.Comm_Msg)
        }
        else if(res.data.Comm_Code==-1)
        {
            alert(res.data.Comm_Msg)
        }
        else 
        {
            alert(res.data.Comm_Msg)
            alert(res.data.Comm_Info.Member_Name)
        }
    })
}



</script>